import { get, post } from './api';
import commonID from '@/utils/commonID';

export const login = (role, account, password) => {
  return post('login', { role, [commonID(role)]: account, password });
};

export function register(account, password, role, avatar = "", period_class = [], position_background = "", academic_background = "") {
  return post('register', { [commonID(role)]: account, password, role, avatar, period_class, position_background, academic_background })
}

export function getAcademicBackground() {
  return get('academicBackground')
}
export function getPositionBackground() {
  return get('positionBackground')
}
export function setAcademicBackground(academics) {
  return post('admin/setAcademicBackground', { academics })
}
export function setPositionBackground(positions) {
  return post('admin/setPositionBackground', { positions })
}